/*****************************************************************************/
/* Step 0. Preparations/Declarations                                         */
/*****************************************************************************/
SET NOCOUNT OFF

/*****************************************************************************/
/* Step 1. Remove stored procedure if it already exists                      */
/*****************************************************************************/
IF (SELECT OBJECT_ID('[Kernel].AddressWith')) IS NOT NULL
BEGIN
  DROP PROCEDURE [Kernel].[AddressWith]
END

GO

/*****************************************************************************/
/* Step 2. Create stored procedure                                           */
/*****************************************************************************/
CREATE PROCEDURE [Kernel].[AddressWith]( @AddressOID BIGINT )
AS 
BEGIN

	Select *
		From dbo.Addresses
		Where OID = @AddressOID

END

GO
/******************************************************************************/
/* Step 3. Assign appropriate permissions                                     */
/******************************************************************************/
GRANT EXECUTE ON [Kernel].[AddressWith] TO [Liberty_Users]
GO
-- Developers and Admins have permissions to execute through membership          